#ifndef TEXTOPERATOR_H
#define TEXTOPERATOR_H

#include <QObject>
#include <RobotMap/RobotItem.h>
#include <QFile>
#include <QDebug>
#include <QThread>

class TextOperator : public QThread
{
    Q_OBJECT
public:
    TextOperator(const QString& fileName, int interval = 100);

    /**
    * @brief 读取数据
    */
    void readData();
    RobotBaseData getData() {return m_data;}
    /**
    * @brief 设置运行状态
    */
    void setRunning(bool state) {m_isRunning = state;}
    /**
    * @brief  设置运行间隔
    */
    void setInterval(int interval) {m_interval = interval;}

protected:
    void run() override;

private:
    RobotBaseData m_data;
    QString m_fileName; //文件
    int m_interval; //查询间隔
    bool m_isRunning = false;

signals:
    RobotBaseData dataRefresh(RobotBaseData&);
};

#endif // TEXTOPERATOR_H
